<?php

namespace DebugComponent\Storage;

/**
 * File storage
 */
class File implements \DebugComponent\IStorage {

    /**
     * Class constructor
     *
     * @param string $filename
     * @return File instance
     */
    public function __construct($filename) {
        $this->filename = $filename;
    }

    /**
     * Write/append data to file
     *
     * @param mixed $data
     * @return void
     * @see \DebugComponent\IStorage
     */
    public function write($data) {
        \file_put_contents($this->filename, $data . "\n", \FILE_APPEND);
    }

    /**
     * @var string filename
     */
    private $filename;
}